package mapper;

import DO.ClassesDO;
import VO.ClassesVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface ClassesMapper {

    /**
     * 获取全部班级信息,屏蔽掉已经删除掉的
     * @return
     */
    @Select("select id, class_name, default_class from classes where is_delete = 0 order by class_name")
    List<ClassesVO> getClasses();

    /**
     * 添加班级
     * @param classesDO
     */
    void insert(ClassesDO classesDO);

    /**
     * 修改默认班级
     * @param id
     * @param DefaultClass
     */
    void updateDefaultClass(Integer id, Integer DefaultClass);

    /**
     * 删除班级
     * @param id
     */
    @Update("update classes set is_delete = 1,class_name = #{className} where id = #{id}")
    void deleteClass(Integer id,String className);
}
